const fs=require('fs');
const mimes=require('./mimes');

module.exports=_path=>{
    console.log('walk _path:',_path);
    let files=fs.readdirSync(_path);
    console.log('files:',files);

    let dirList=[],fileList=[];

    for(let i=0;i<files.length;i++){
        let item=files[i];
        let itemArr=item.split('.');
        let itemMime=(itemArr.length>1)?itemArr[itemArr.length-1]:'undefined';

        if('undefined'==typeof mimes[itemMime]){
            dirList.push('./'+files[i]);
        }else{
            fileList.push(files[i]);
        }
        console.log('dirList:',dirList);
        console.log('fileList:',fileList);
    }
    return dirList.concat(fileList);
};